import { Context, DefaultState } from 'koa'
import KoaRouter from 'koa-router'

const userRouter = new KoaRouter<DefaultState, Context>()

userRouter.prefix('/user')

userRouter.get('/findUserInfo/:username', async (ctx: Context) => {
  const { username } = ctx.params
  ctx.success(`欢迎！${username}`)
})

userRouter.post('/addUser', async (ctx: Context) => {
  const userInfo = ctx.request.body
  ctx.success(`欢迎${userInfo.username}, 您的密码是: ${userInfo.password}`)
})

module.exports = userRouter
